RandomShuffle Generic Method

Wintellect PowerCollections

Collapse imageExpand ImageCollapseAll imageExpandAll imageDropDown imageDropDownHover imageCopy imageCopyHover image
[This topic is pre-release documentation and is subject to change in future releases. Blank topics are included as placeholders.]

Randomly shuffles the items in a collection, yielding a new collection.

Namespace: Wintellect.PowerCollections
Assembly:  PowerCollections (in PowerCollections.dll)

Syntax

C#
public static T[] RandomShuffle<T>(
	IEnumerable<T> collection,
	Random randomGenerator
)
Visual Basic (Declaration)
Public Shared Function RandomShuffle(Of T) ( _
	collection As IEnumerable(Of T), _
	randomGenerator As Random _
) As T()
Visual C++
public:
generic<typename T>
static array<T>^ RandomShuffle (
	IEnumerable<T>^ collection, 
	Random^ randomGenerator
)

Parameters

collection
IEnumerable<(Of <T>)>
The collection to shuffle.
randomGenerator
Random
The random number generator to use to select the random order.

Return Value

An array with the same size and items as collection, but the items in a randomly chosen order.

Type Parameters

T
The type of the items in the collection.

See Also